package com.financing.wap.dao;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.financing.wap.common.Pager;
import com.financing.wap.dao.wherecondition.WhereCondition;
import com.financing.wap.dto.*;
import com.financing.wap.vo.OrderCountVO;
import com.financing.wap.vo.OrderDoneCountDto;
import com.financing.wap.vo.OrderResVO;
import com.financing.wap.vo.OrderVO;

/**
 * @author Mars
 * @createDate 2014年8月22日
 */
public interface IOrderDao extends IBaseDao<OrderDTO, Integer> {
	
	/**
	 * 订单列表
	 * @param where
	 * @return
	 */
	public List<OrderDTO> getOrderList(OrderVO where);
	
	/**
	 * 订单列表数
	 * @param where
	 * @return
	 */
	public Integer getOrderListCount(OrderVO where);
	
	/**
	 * 订单详情
	 * @param id
	 * @return
	 */
	public OrderDTO getOrder(String id);
	/**
	 * 更改订单状态
	 * @param order
	 */
	public void changeOrderStatus(OrderDTO order);
	
	/**
	 * 申请预约
	 * @param order
	 * @return
	 */
	public String applyPreOrder(OrderDTO order);
	
	/**
	 * 机构订单列表
	 * @param where
	 * @return
	 */
	public List<OrderDTO> getCorpOrderList(OrderVO where);


	/**
	 * 机构订单列列表总数
	 * @param where
	 * @return
	 */
	public Integer getCorpOrderListCount(OrderVO where);
	
	/**
	 * 新增订单流水记录
	 * @param where
	 * @return
	 */
	public Integer insertOrderFlow(OrderFlowDTO dto);
	
	/**
	 * 
	 * @Title: queryTOPOrder
	 * @Description: 查询前几笔订单 
	 * @param @param limit
	 * @param @return   
	 * @return List<OrderVO>   
	 * @throws
	 */
	public List<OrderDTO> queryTOPOrder(Integer limit);
	
	/**
	 * 
	 * @Title: countDealOrder
	 * @Description: 查询FA成交订单总数 
	 * @param @param faId
	 * @param @return   
	 * @return Integer   
	 * @throws
	 */
	public Integer countDealOrder(String faId);

	/**
	 * 获取个人订单总金额
	 * @param map
	 * @return
	 */
	public BigDecimal getOrderAmountCount(Map<String, Object> map);
	
	/**
	 * 
	 * @Title: countDealOrder
	 * @Description: 根据理财师ID查询订单管理员
	 * @param @param faId
	 * @param @return   
	 * @return Integer   
	 * @throws
	 */
	public List<String> countOrderManagerForUserId(String faId);
	
	/**
	 * 根据邀请人查询订单管理人员
	 * @param sourceCode
	 * @return
	 */
	public List<String> queryOrderManagerUserBySource(String sourceCode);

	/**
	 * @param corpId
	 * @return
	 */
	public List<Integer> getSonFaidList(String corpId);

	public Integer getBiddingProjectListCount(OrderVO orderVo);

	public List<YouDanOrderByProjectDTO> getBiddingProjectList(OrderVO where);

	public BigDecimal getYouDanReservedAmountByProjectId(Map<String, Object> tempMap);

	public BigDecimal getYouDanConfirmedAmountByProjectId(Map<String, Object> tempMap);

	public BigDecimal getMyYouDanOrderAllRebateAmount(OrderVO orderVo);

	public BigDecimal getPayingCommission(Map<String, Object> tempMap);

	public BigDecimal getPayedCommission(Map<String, Object> tempMap);

	public Integer getYouDanOrderListCount(OrderVO orderVo);

	public List<OrderDTO> getYouDanOrderList(OrderVO orderVo);

	public OrderDTO getYouDanOrderDetail(OrderVO orderVo);

	public YouDanOrderByProjectDTO getYouDanCommissionByProduct(Map<String, Object> tempMap);

	public ProductDTO getProduct(Map<String, Object> tempMap);

	public HashMap<String, Object> getYouDanAmountByOrder(OrderDTO orderDto);

	public List<YouDanCommissionDTO> myBiddingProjectCommission(Map<String, Object> tempMap);
	/**
	 * 出单 非有单前端佣金
	 */
	public BigDecimal getMyOrderFrontRebateAmount(OrderVO orderVo);
	/**
	 * 出单 非有单后端佣金
	 */
	public BigDecimal getMyOrderBackRebateAmount(OrderVO orderVo);
	/**
	 * 出单 有单佣金
	 */
	public BigDecimal getMyAllOrderRebateAmount(OrderVO orderVo);

	public BigDecimal orderCommissionCount(String faId);

	public BigDecimal queryOrderCostCount(FpOrderCostDTO orderCost);

	public List<OrderCountVO> orderListCount(OrderDTO orderDto);
	
	public List<OrderCountVO> orderTimesCount(OrderDTO order);

	public List<OrderCountVO> orderTimesCountDone(OrderDTO orderDto);
	
	/**
	 * 金策师机构版 - 订单折线图统计<预约订单+成交订单>
	 * 
	 * @param order
	 * @param fpman
	 * @return
	 */
	public List<OrderCountVO> orderCountByTimeAndOrg(OrderDTO order, FpManagerOrder fpman);
	
	/**
	 * 金策师机构版 - 统计已成交的订单
	 * 
	 * @param order
	 * @param fpman
	 * @param wc
	 * @return
	 */
	public OrderDoneCountDto queryCountOrderDone(OrderDTO order, FpManagerOrder fpman, WhereCondition wc);
	
	/**
	 * 金策师机构版 - 查询统计已成交的订单
	 * 
	 * @param orderDto
	 * @param fpman
	 * @param wc
	 * @param pager
	 * @return
	 */
	public List<OrderResVO> queryOrderDoneByWherecondition(OrderDTO orderDto, FpManagerOrder fpman, WhereCondition wc);
	
	/**
	 * 金策师机构版 - 订单折线图统计 <筛选全部> 横坐标获取
	 * 
	 * @param order
	 * @param fpman
	 * @return
	 */
	public List<String> queryOrderXaxisDatas(OrderDTO order, FpManagerOrder fpman);
	
}
